{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[1, 2]\n"
     ]
    },
    {
     "ename": "LinAlgError",
     "evalue": "1-dimensional array given. Array must be at least two-dimensional",
     "output_type": "error",
     "traceback": [
      "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[1;31mLinAlgError\u001b[0m                               Traceback (most recent call last)",
      "\u001b[1;32md:\\gitee\\AdvancedAlgebra\\高等代数\\python_矩阵伴随\\求矩阵伴随.py\u001b[0m in \u001b[0;36mline 19\n\u001b[0;32m     <a href='file:///d%3A/gitee/AdvancedAlgebra/%E9%AB%98%E7%AD%89%E4%BB%A3%E6%95%B0/python_%E7%9F%A9%E9%98%B5%E4%BC%B4%E9%9A%8F/%E6%B1%82%E7%9F%A9%E9%98%B5%E4%BC%B4%E9%9A%8F.py?line=14'>15</a>\u001b[0m     \u001b[39mreturn\u001b[39;00m(b\u001b[39m.\u001b[39mT)\n\u001b[0;32m     <a href='file:///d%3A/gitee/AdvancedAlgebra/%E9%AB%98%E7%AD%89%E4%BB%A3%E6%95%B0/python_%E7%9F%A9%E9%98%B5%E4%BC%B4%E9%9A%8F/%E6%B1%82%E7%9F%A9%E9%98%B5%E4%BC%B4%E9%9A%8F.py?line=17'>18</a>\u001b[0m a \u001b[39m=\u001b[39m np\u001b[39m.\u001b[39marray([[\u001b[39m1\u001b[39m,\u001b[39m0\u001b[39m,\u001b[39m0\u001b[39m],[\u001b[39m0\u001b[39m,\u001b[39m1\u001b[39m,\u001b[39m0\u001b[39m],[\u001b[39m0\u001b[39m,\u001b[39m0\u001b[39m,\u001b[39m0\u001b[39m]])\n\u001b[1;32m---> <a href='file:///d%3A/gitee/AdvancedAlgebra/%E9%AB%98%E7%AD%89%E4%BB%A3%E6%95%B0/python_%E7%9F%A9%E9%98%B5%E4%BC%B4%E9%9A%8F/%E6%B1%82%E7%9F%A9%E9%98%B5%E4%BC%B4%E9%9A%8F.py?line=18'>19</a>\u001b[0m a_adj \u001b[39m=\u001b[39m cal_adj(a)\n\u001b[0;32m     <a href='file:///d%3A/gitee/AdvancedAlgebra/%E9%AB%98%E7%AD%89%E4%BB%A3%E6%95%B0/python_%E7%9F%A9%E9%98%B5%E4%BC%B4%E9%9A%8F/%E6%B1%82%E7%9F%A9%E9%98%B5%E4%BC%B4%E9%9A%8F.py?line=19'>20</a>\u001b[0m \u001b[39mprint\u001b[39m(a_adj)\n",
      "\u001b[1;32md:\\gitee\\AdvancedAlgebra\\高等代数\\python_矩阵伴随\\求矩阵伴随.py\u001b[0m in \u001b[0;36mline 14\u001b[0m, in \u001b[0;36mcal_adj\u001b[1;34m(a)\n\u001b[0;32m     <a href='file:///d%3A/gitee/AdvancedAlgebra/%E9%AB%98%E7%AD%89%E4%BB%A3%E6%95%B0/python_%E7%9F%A9%E9%98%B5%E4%BC%B4%E9%9A%8F/%E6%B1%82%E7%9F%A9%E9%98%B5%E4%BC%B4%E9%9A%8F.py?line=11'>12</a>\u001b[0m         y_index \u001b[39m=\u001b[39m \u001b[39mlist\u001b[39m(\u001b[39mrange\u001b[39m(n))\n\u001b[0;32m     <a href='file:///d%3A/gitee/AdvancedAlgebra/%E9%AB%98%E7%AD%89%E4%BB%A3%E6%95%B0/python_%E7%9F%A9%E9%98%B5%E4%BC%B4%E9%9A%8F/%E6%B1%82%E7%9F%A9%E9%98%B5%E4%BC%B4%E9%9A%8F.py?line=12'>13</a>\u001b[0m         y_index\u001b[39m.\u001b[39mremove(j)\n\u001b[1;32m---> <a href='file:///d%3A/gitee/AdvancedAlgebra/%E9%AB%98%E7%AD%89%E4%BB%A3%E6%95%B0/python_%E7%9F%A9%E9%98%B5%E4%BC%B4%E9%9A%8F/%E6%B1%82%E7%9F%A9%E9%98%B5%E4%BC%B4%E9%9A%8F.py?line=13'>14</a>\u001b[0m         b[i,j] \u001b[39m=\u001b[39m np\u001b[39m.\u001b[39;49mlinalg\u001b[39m.\u001b[39;49mdet(a[x_index,y_index])\n\u001b[0;32m     <a href='file:///d%3A/gitee/AdvancedAlgebra/%E9%AB%98%E7%AD%89%E4%BB%A3%E6%95%B0/python_%E7%9F%A9%E9%98%B5%E4%BC%B4%E9%9A%8F/%E6%B1%82%E7%9F%A9%E9%98%B5%E4%BC%B4%E9%9A%8F.py?line=14'>15</a>\u001b[0m \u001b[39mreturn\u001b[39;00m(b\u001b[39m.\u001b[39mT)\n",
      "File \u001b[1;32m<__array_function__ internals>:180\u001b[0m, in \u001b[0;36mdet\u001b[1;34m(*args, **kwargs)\u001b[0m\n",
      "File \u001b[1;32md:\\python38\\Python38\\lib\\site-packages\\numpy\\linalg\\linalg.py:2142\u001b[0m, in \u001b[0;36mdet\u001b[1;34m(a)\u001b[0m\n\u001b[0;32m   <a href='file:///d%3A/python38/Python38/lib/site-packages/numpy/linalg/linalg.py?line=2093'>2094</a>\u001b[0m \u001b[39m\u001b[39m\u001b[39m\"\"\"\u001b[39;00m\n\u001b[0;32m   <a href='file:///d%3A/python38/Python38/lib/site-packages/numpy/linalg/linalg.py?line=2094'>2095</a>\u001b[0m \u001b[39mCompute the determinant of an array.\u001b[39;00m\n\u001b[0;32m   <a href='file:///d%3A/python38/Python38/lib/site-packages/numpy/linalg/linalg.py?line=2095'>2096</a>\u001b[0m \n\u001b[1;32m   (...)\u001b[0m\n\u001b[0;32m   <a href='file:///d%3A/python38/Python38/lib/site-packages/numpy/linalg/linalg.py?line=2138'>2139</a>\u001b[0m \n\u001b[0;32m   <a href='file:///d%3A/python38/Python38/lib/site-packages/numpy/linalg/linalg.py?line=2139'>2140</a>\u001b[0m \u001b[39m\"\"\"\u001b[39;00m\n\u001b[0;32m   <a href='file:///d%3A/python38/Python38/lib/site-packages/numpy/linalg/linalg.py?line=2140'>2141</a>\u001b[0m a \u001b[39m=\u001b[39m asarray(a)\n\u001b[1;32m-> <a href='file:///d%3A/python38/Python38/lib/site-packages/numpy/linalg/linalg.py?line=2141'>2142</a>\u001b[0m _assert_stacked_2d(a)\n\u001b[0;32m   <a href='file:///d%3A/python38/Python38/lib/site-packages/numpy/linalg/linalg.py?line=2142'>2143</a>\u001b[0m _assert_stacked_square(a)\n\u001b[0;32m   <a href='file:///d%3A/python38/Python38/lib/site-packages/numpy/linalg/linalg.py?line=2143'>2144</a>\u001b[0m t, result_t \u001b[39m=\u001b[39m _commonType(a)\n",
      "File \u001b[1;32md:\\python38\\Python38\\lib\\site-packages\\numpy\\linalg\\linalg.py:196\u001b[0m, in \u001b[0;36m_assert_stacked_2d\u001b[1;34m(*arrays)\u001b[0m\n\u001b[0;32m    <a href='file:///d%3A/python38/Python38/lib/site-packages/numpy/linalg/linalg.py?line=193'>194</a>\u001b[0m \u001b[39mfor\u001b[39;00m a \u001b[39min\u001b[39;00m arrays:\n\u001b[0;32m    <a href='file:///d%3A/python38/Python38/lib/site-packages/numpy/linalg/linalg.py?line=194'>195</a>\u001b[0m     \u001b[39mif\u001b[39;00m a\u001b[39m.\u001b[39mndim \u001b[39m<\u001b[39m \u001b[39m2\u001b[39m:\n\u001b[1;32m--> <a href='file:///d%3A/python38/Python38/lib/site-packages/numpy/linalg/linalg.py?line=195'>196</a>\u001b[0m         \u001b[39mraise\u001b[39;00m LinAlgError(\u001b[39m'\u001b[39m\u001b[39m%d\u001b[39;00m\u001b[39m-dimensional array given. Array must be \u001b[39m\u001b[39m'\u001b[39m\n\u001b[0;32m    <a href='file:///d%3A/python38/Python38/lib/site-packages/numpy/linalg/linalg.py?line=196'>197</a>\u001b[0m                 \u001b[39m'\u001b[39m\u001b[39mat least two-dimensional\u001b[39m\u001b[39m'\u001b[39m \u001b[39m%\u001b[39m a\u001b[39m.\u001b[39mndim)\n",
      "\u001b[1;31mLinAlgError\u001b[0m: 1-dimensional array given. Array must be at least two-dimensional"
     ]
    }
   ],
   "source": [
    "import numpy as np\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "a = np.array([[1,0,0],[0,1,0],[0,0,0]])\n",
    "a_adj = cal_adj(a)\n",
    "print(a_adj)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([0, 0])"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "a[(1,2),(0,1)]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "ename": "IndexError",
     "evalue": "index 3 is out of bounds for axis 0 with size 3",
     "output_type": "error",
     "traceback": [
      "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[1;31mIndexError\u001b[0m                                Traceback (most recent call last)",
      "Cell \u001b[1;32mIn[3], line 1\u001b[0m\n\u001b[1;32m----> 1\u001b[0m a[[\u001b[39m1\u001b[39;49m,\u001b[39m2\u001b[39;49m,\u001b[39m3\u001b[39;49m,\u001b[39m4\u001b[39;49m]]\n",
      "\u001b[1;31mIndexError\u001b[0m: index 3 is out of bounds for axis 0 with size 3"
     ]
    }
   ],
   "source": [
    "a[[1,2,3,4]]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "ename": "IndexError",
     "evalue": "too many indices for array: array is 2-dimensional, but 4 were indexed",
     "output_type": "error",
     "traceback": [
      "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[1;31mIndexError\u001b[0m                                Traceback (most recent call last)",
      "Cell \u001b[1;32mIn[4], line 1\u001b[0m\n\u001b[1;32m----> 1\u001b[0m a[\u001b[39m1\u001b[39;49m,\u001b[39m2\u001b[39;49m,\u001b[39m3\u001b[39;49m,\u001b[39m4\u001b[39;49m]\n",
      "\u001b[1;31mIndexError\u001b[0m: too many indices for array: array is 2-dimensional, but 4 were indexed"
     ]
    }
   ],
   "source": [
    "a[1,2,3,4]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([0, 0, 0])"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "a[2]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "ename": "IndexError",
     "evalue": "index 3 is out of bounds for axis 0 with size 3",
     "output_type": "error",
     "traceback": [
      "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[1;31mIndexError\u001b[0m                                Traceback (most recent call last)",
      "Cell \u001b[1;32mIn[6], line 1\u001b[0m\n\u001b[1;32m----> 1\u001b[0m a[\u001b[39m3\u001b[39;49m]\n",
      "\u001b[1;31mIndexError\u001b[0m: index 3 is out of bounds for axis 0 with size 3"
     ]
    }
   ],
   "source": [
    "a[3]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "a[1,2]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [],
   "source": [
    "b = np.random.rand(10,10)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[0.46616211]])"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "b[1:2,2:3]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[0.46616211, 0.71459691, 0.52827888],\n",
       "       [0.55073691, 0.08908274, 0.75654115],\n",
       "       [0.64070356, 0.73392578, 0.06475347],\n",
       "       [0.60743995, 0.62208062, 0.82420147]])"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "b[1:5,2:5]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([0.76120921, 0.55073691, 0.73392578])"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "b[[1,2,3],[1,2,3]]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([0.71459691, 0.08908274, 0.73392578])"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "b[[1,2,3],[3]]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[0.76120921, 0.46616211],\n",
       "       [0.08746998, 0.55073691],\n",
       "       [0.10122434, 0.64070356],\n",
       "       [0.76030654, 0.60743995],\n",
       "       [0.49745982, 0.99904429],\n",
       "       [0.00525391, 0.13144033]])"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "b[[1,2,3,4,5,6],1:3]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[0.76120921, 0.46616211, 0.71459691],\n",
       "       [0.08746998, 0.55073691, 0.08908274],\n",
       "       [0.10122434, 0.64070356, 0.73392578],\n",
       "       [0.76030654, 0.60743995, 0.62208062],\n",
       "       [0.49745982, 0.99904429, 0.76549901],\n",
       "       [0.00525391, 0.13144033, 0.64612807]])"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "b[[1,2,3,4,5,6],1:4]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[6.54674280e-01, 7.61209206e-01, 4.66162114e-01, 7.14596910e-01,\n",
       "        5.28278884e-01, 4.80604306e-01, 3.82918993e-01, 6.06584320e-01,\n",
       "        5.56953232e-01, 5.99374523e-01],\n",
       "       [5.05898065e-01, 8.74699822e-02, 5.50736913e-01, 8.90827423e-02,\n",
       "        7.56541146e-01, 9.05104504e-01, 5.09682686e-02, 7.52212030e-04,\n",
       "        8.22166370e-01, 7.96395550e-01],\n",
       "       [8.56144423e-01, 1.01224338e-01, 6.40703556e-01, 7.33925775e-01,\n",
       "        6.47534706e-02, 6.21268561e-01, 3.49835449e-01, 1.36067536e-01,\n",
       "        2.73166798e-01, 1.17691046e-01],\n",
       "       [4.97332437e-01, 7.60306536e-01, 6.07439948e-01, 6.22080619e-01,\n",
       "        8.24201468e-01, 3.16968121e-01, 8.69708206e-01, 9.19797855e-01,\n",
       "        2.07514480e-01, 8.13750540e-01],\n",
       "       [5.28453961e-01, 4.97459824e-01, 9.99044293e-01, 7.65499007e-01,\n",
       "        3.01315805e-01, 5.96293680e-01, 2.44445401e-01, 1.12920994e-01,\n",
       "        7.60072410e-01, 4.48825272e-01],\n",
       "       [5.51534282e-02, 5.25390601e-03, 1.31440328e-01, 6.46128066e-01,\n",
       "        3.19016815e-01, 3.93922558e-01, 7.44900506e-01, 4.57609810e-01,\n",
       "        7.36805703e-01, 1.64685186e-01],\n",
       "       [5.56922702e-01, 8.34347100e-01, 5.14446165e-01, 4.43982218e-01,\n",
       "        6.11319466e-01, 6.82474106e-01, 4.17694205e-01, 4.26939450e-01,\n",
       "        8.37131888e-01, 2.65771342e-01],\n",
       "       [6.88612619e-01, 6.84987344e-01, 9.42567089e-01, 8.81561841e-01,\n",
       "        2.44227088e-01, 7.45429751e-01, 4.75775194e-01, 4.01601306e-01,\n",
       "        8.59382697e-01, 9.31535135e-02],\n",
       "       [2.10800706e-01, 8.36075488e-01, 8.21549161e-01, 3.81479991e-02,\n",
       "        5.04156881e-01, 1.88984569e-02, 7.15045105e-01, 5.23064076e-01,\n",
       "        3.79042126e-01, 9.84336471e-01]])"
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "b[1:10]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[1, 0, 0],\n",
       "       [0, 1, 0],\n",
       "       [0, 0, 0]])"
      ]
     },
     "execution_count": 16,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "a"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0"
      ]
     },
     "execution_count": 17,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "a[0,2]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[1, 0, 0],\n",
       "       [0, 0, 0]])"
      ]
     },
     "execution_count": 18,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "a[[0,2]]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {},
   "outputs": [
    {
     "ename": "IndexError",
     "evalue": "index 2 is out of bounds for axis 0 with size 2",
     "output_type": "error",
     "traceback": [
      "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[1;31mIndexError\u001b[0m                                Traceback (most recent call last)",
      "Cell \u001b[1;32mIn[19], line 1\u001b[0m\n\u001b[1;32m----> 1\u001b[0m a[[\u001b[39m0\u001b[39;49m,\u001b[39m2\u001b[39;49m]][[\u001b[39m0\u001b[39;49m,\u001b[39m2\u001b[39;49m]]\n",
      "\u001b[1;31mIndexError\u001b[0m: index 2 is out of bounds for axis 0 with size 2"
     ]
    }
   ],
   "source": [
    "a[[0,2]][[0,2]]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0"
      ]
     },
     "execution_count": 20,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "a[[0,2]][0,2]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(2, 3)"
      ]
     },
     "execution_count": 21,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "a[[0,2]].shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[1, 0],\n",
       "       [0, 0]])"
      ]
     },
     "execution_count": 22,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "a[[0,2]][:,[0,2]]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "矩阵伴随为:\n",
      "[[0. 0. 0.]\n",
      " [0. 0. 0.]\n",
      " [0. 0. 1.]]\n",
      "----------------------------------------\n"
     ]
    }
   ],
   "source": [
    "import numpy as np\n",
    "\n",
    "def cal_adj(a:np.array):\n",
    "    assert a.shape[0] == a.shape[1]\n",
    "    n = a.shape[0]\n",
    "    b = np.zeros((n,n))\n",
    "    for i in range(n):\n",
    "        x_index = list(range(n))\n",
    "        x_index.remove(i)\n",
    "        for j in range(n):\n",
    "            y_index = list(range(n))\n",
    "            y_index.remove(j)\n",
    "            b[i,j] = np.linalg.det(a[x_index][:,y_index])\n",
    "    return(b.T)\n",
    "\n",
    "\n",
    "a = np.array([[1,0,0],[0,1,0],[0,0,0]])\n",
    "a_adj = cal_adj(a)\n",
    "print(\"矩阵伴随为:\")\n",
    "print(a_adj)\n",
    "print(\"-\"*40)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {},
   "outputs": [],
   "source": [
    "vals1,vecs1= np.linalg.eig(a)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {},
   "outputs": [],
   "source": [
    "vals1,vecs1= np.linalg.eig(a_adj)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "metadata": {},
   "outputs": [],
   "source": [
    "vals2,vecs2= np.linalg.eig(a_adj)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "metadata": {},
   "outputs": [],
   "source": [
    "vals1,vecs1= np.linalg.eig(a)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[1., 0., 0.],\n",
       "       [0., 1., 0.],\n",
       "       [0., 0., 1.]])"
      ]
     },
     "execution_count": 28,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "vecs1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[1., 0., 0.],\n",
       "       [0., 1., 0.],\n",
       "       [0., 0., 1.]])"
      ]
     },
     "execution_count": 29,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "vecs2"
   ]
  }
 ],
 "metadata": {
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": 3
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
